﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace kinokasse.datamodel.contracts
{
    [Serializable]
    public class Saalplan
    {
        public Saalplan(IEnumerable<Sitz> sitze)
        {
            Sitze = sitze;
        }

        public IEnumerable<Sitz> Sitze { get; private set; }

        #region Equality Members
        public bool Equals(Saalplan other)
        {
            return this.Sitze.SequenceEqual(other.Sitze);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (Saalplan)) return false;
            return Equals((Saalplan) obj);
        }

        public override int GetHashCode()
        {
            return (Sitze != null ? Sitze.GetHashCode() : 0);
        }
        #endregion
    }
}